package dfbz.homework1;

public class Test15 {
    public static void main(String[] args) {
        int arr[] = {1, 2, 3, 4, 3, 2, 1};
        checkArr(arr);
    }
    public static void checkArr(int[] arr){
        boolean flag=false;//初始化一个flag标记为false
        //遍历数组arr
        for (int i = 0; i <arr.length/2 ; i++) {
            //首尾判断 i  arr.length-1-i
            if(arr[i]!=arr[arr.length-1-i]){
                flag=false;
            }else {
                flag=true;
            }
        }
        System.out.println("该数组是否对称"+flag);
    }
}
